<template>
  <div class="card">
    <div class="card-header" :class="flag=='left'?'left-img':'right-img'">
      <span class="card-title">{{data.title}}</span>
    </div>
    <div class="card-body">
      <slot/>
    </div>
  </div>
</template>

<script setup lang="ts">
defineProps({
  data: {
    type: Object as () => ({title: string}),
    required: true
  },
  flag:{
    type: String,
    default: "left"
  }
})
</script>

<style scoped>
.card{
  width: 450px; /* 限制最大宽度 */
}

.card-header{
  display: flex;
  justify-content: center;
  align-items: center;
  background-size: cover;
  background-repeat: no-repeat;
  position: relative;
  width: 100%;
  min-height: 75px;
}

.left-img {
  background-image: url('@/assets/preview (12).png');
}

.right-img {
  background-image: url('@/assets/preview (13).png');
}

.card-title{
  font-size: 26px;
  font-family: NewFont,serif;
  color: white;
  text-align: center;
  word-wrap: break-word;
}

.card-body {
  padding: 1px;
  display: flex;
  justify-content: center;
  align-items: center;
}
</style>
